﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace An_Im.Converter
{
    internal class SvgToImageCoverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (parameter == null) return null;
            var fileName = parameter.ToString();
            var svgbytes = Properties.Resources.ResourceManager.GetObject(fileName) as byte[];
            using (var stream = new MemoryStream(svgbytes, false))
            {
                return Svg2Xaml.SvgReader.Load(stream);
            }

            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
